#include "HardWare.h"

/*---------------------------------------------------------------------------*/
/*	 */
/*---------------------------------------------------------------------------*/
void SystemClockConfigure()
{   
   _wdtc = 0x57;						/* enable WDT,time-out period=2^18/fs */
   //_lvrc = 0x5A;						/* LVR voltage = 1.7V */
   _lvrc = 0b01010101;
	// _scc = 0x01;						/* system clock=HIRC */
	// _nop();	
	// while(!_hircf);	
    _smod = 0x01;                       /* system clock=HIRC */
	GCC_NOP();
    while(!_hto);
}

/*---------------------------------------------------------------------------*/
 
/*---------------------------------------------------------------------------*/
void Clear_RamInit()
{
	_bp = 0;
	_mp1 = 0x80;
	for(_tblp = 0x80;_tblp >0;_tblp--)
	{
		_iar1 = 0;
		_mp1++;
	}	
}
/*---------------------------------------------------------------------------*/
 
/*---------------------------------------------------------------------------*/
void IO_Init()
{
	// _papu |= 0xff;
	// _pac  |= 0xff;
	// _pbpu |= 0xff;
	// _pbc  |= 0xff;
	// // _pcpu |= 0x0f;
	// // _pcc  |= 0x0f;
	// _pac1 = LOW;		
	// _pa1  = LOW;
	// // _pbc3 = LOW;
	// // _pb3  = LOW;//LED初始化		

    _pa   = 0b00000010;
    _papu = 0b00000000;
    _pac  = 0b00000000;
    _paps0 = 0b10001000;
    _paps1 = 0b00000000;
    
    _pb   = 0b10000000;
    _pbpu = 0b10000000;
    _pbc  = 0b10000000;

    _pd   = 0b00000000;
    _pdpu = 0b00000000;
    _pdc  = 0b00000000;
}
/*---------------------------------------------------------------------------*/
 
/*---------------------------------------------------------------------------*/
